<template>
  <div class="policy-table">
    <!-- 信息列表 -->
    <el-table
      :data="childrenListPage"
      style="width: calc(100% - 30px);margin:10px;"
      :header-cell-style="{
        'background-color': 'rgb(97, 115, 198)',
        color: '#fff',
        textAlign: 'center',
      }"
      :row-style="{ height: '18px' }"
      :cell-style="{ padding: '2.5px 0' }"
      height="560"
    >
      <el-table-column
        type="index"
        width="80"
        label="序号"
        align="center"
        :index="indexMethod"
      ></el-table-column>
      <el-table-column
        property="name"
        label="政策标题"
        width="350"
        align="center"
        prop="title"
      ></el-table-column>
      <el-table-column
        property="name"
        label="政策级别"
        width="100"
        align="center"
        prop="level.desc"
      ></el-table-column>

      <el-table-column
        property="name"
        label="政策类型"
        width="100"
        align="center"
        prop="type.desc"
      ></el-table-column>

      <el-table-column
        property="name"
        label="政策来源"
        width="180"
        align="center"
        prop="source"
      ></el-table-column>

      <el-table-column
        property="date"
        label="政策颁布时间"
        width="220"
        align="center"
        prop="awardTime"
      ></el-table-column>

      <el-table-column
        property="date"
        label="新增时间"
        width="220"
        align="center"
        prop="publishTime"
      ></el-table-column>
      <el-table-column
        property="examineResult"
        label="状态"
        width="120"
        align="center"
        prop="examineResult.desc"
      ></el-table-column>
      <el-table-column label="操作" align="center">
        <template slot-scope="scope">
          <el-button
            type="text"
            @click="auditReviewDetail(scope.row)"
            style="margin-right:30px;font-size:14px"
          >
            详情
          </el-button>
          <el-button
            type="text"
            @click="audit(scope.row)"
            style="margin-right:-10px;font-size:14px"
            :disabled="dontClick(scope.row)"
          >
            审核
          </el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
//* 获取政策发布详情信息
import { getAuditPolicyInfo } from '@/api/policy/audit/index'
export default {
  name: 'PolicyTable',
  props: { childrenListPage: Array, childrenForm: Object },
  data() {
    return {
      tableData: this.childrenListPage,
      id: '',
    }
  },
  methods: {
    //*跳审核
    audit(e) {
      let id = e.id
      this.$router.push({ name: 'PolicyReviewAdd', query: { id: id } })
    },
    //*跳详情
    auditReviewDetail(e) {
      this.id = e.id
      this.$router.push({
        name: 'AuditPolicyDetail',
        query: { id: this.id },
      })
    },
    indexMethod(index) {
      let curpage = this.childrenForm.currPage //单前页码，具体看组件取值
      let limitpage = this.childrenForm.pageSize //每页条数，具体是组件取值
      return index + 1 + (curpage - 1) * limitpage
    },
    dontClick: (e) => {
      return e.examineResult.value === 1 || e.examineResult.value === 2
    },
  },
}
</script>

<style scoped>
</style>
